package com.fs.sys.entityservice.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fs.common.base.service.AbstractSimpleEntityService;
import com.fs.sys.bean.dto.TenantUserDTO;
import com.fs.sys.bean.query.TenantUserQuery;
import com.fs.sys.domain.entity.TenantUserEntity;
import com.fs.sys.domain.mapper.TenantUserMapper;
import com.fs.sys.entityservice.TenantUserEntityService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * 租户用户关系服务实现 
 * @author Coder Generator 2025-06-13 21:09:55 
 **/
@Service
public class TenantUserEntityServiceImpl extends AbstractSimpleEntityService<TenantUserEntity, TenantUserDTO, TenantUserMapper, TenantUserQuery> implements TenantUserEntityService {
    @Override
    protected QueryWrapper<TenantUserEntity> queryToWrapper(TenantUserQuery query) {
        return this.createQueryWrapper()
                .eq(StringUtils.isNotBlank(query.getId()), "id", query.getId())
                .in(null != query.getIds(), "id", query.getIds())
                .eq(StringUtils.isNotBlank(query.getTenantId()), "tenant_id", query.getTenantId())
                .orderByDesc("create_time");
    }

    /**
     * 如果在在租户编号时，是否需要根据租户编号进行筛选
     *
     * @return 是否根据租户编号筛选数据
     */
    @Override
    protected boolean filterByTenant() {
        return false;
    }
}